1. /******************************************************************************/
  2. #define F_CPU 16000000UL
  3. #include <avr/io.h>
  4. #include <util/delay.h>
  5. #include <avr/sleep.h>
  6. #include <avr/interrupt.h>
  7. /******************************************************************************/
  8. int main(void)
  9. {
  10. cli();
  11. DDRD &= ~_BV(DDRD0); // set as input
  12. PORTD |= _BV(PORTD0); // enable pull-up
  13. DDRB |= _BV(DDB5);
  14. PORTB |= _BV(PINB5); // initialize to high
  15. PCICR |= _BV(PCIE2); // set PCIE2 to enable PCMSK2 scan
  16. PCMSK2 |= _BV(PCINT16); // set PCINT16 to trigger an interrupt on state change
  17. sei(); // turn on interrupts
  18. while (1) asm volatile ("nop"::);
  19. }
  20. /******************************************************************************/
  21. ISR (PCINT2_vect) {}
  22. /******************************************************************************/